<template>
  <div>
    <el-row style="text-align: center; background-color: #4686fc; border: 3px solid black">
      <el-row style="font-size: 50px; height: 80px; line-height: 80px; color: #ffffff">易下管理系统</el-row>
      <el-row style="text-align: right; height: 50px; font-size: 20px">
        <span style="color: #fff2d5">
          <div style="display: inline-block; color: red">{{user.roleId == 2 ? "管理员" : (user.roleId == 1 ? "经理" : "")}}：</div>
          <div style="display: inline-block; color: bisque; margin-right: 10px">{{user.nickname}}</div>
          <el-avatar style="position: relative; top: 10px;"
                     :src="(user.icon != null && user.icon != '') ? user.icon : 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'">
          </el-avatar>
        </span>
      </el-row>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "AdminHeader",
  data() {
    return {
      user: {}
    }
  },
  created() {
    this.loadUserData();
  },
  methods: {
    loadUserData() {
      this.request.get("/admin/user/me").then(res => {
        if (res.code == 200) {
          this.user = res.data;
          this.$store.commit('updateUser', this.user);
        }
      });
    }
  }
}
</script>

<style scoped>

</style>
